package com.yiqi.liebang.feature.wallet.view;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yiqi.liebang.R;
import com.yiqi.liebang.common.widget.dialog.BottomBaseDialog;
import com.yiqi.liebang.common.widget.dialog.BounceBottomEnter;

public class WithdrawDialog extends BottomBaseDialog<WithdrawDialog> {


    ImageView mBtnBack;

    ImageView mIvPayAlipay;
    RelativeLayout mBtnPayAlipay;
    ImageView mIvPayWechat;
    RelativeLayout mBtnPayWechat;
    private MyClickListenerInterface listenerInterface;

    public WithdrawDialog(Context context, View animateView) {
        super(context, animateView);
    }

    public WithdrawDialog(Context context) {
        super(context);
    }

    @Override
    public View onCreateView() {
        showAnim(new BounceBottomEnter());
        dismissAnim(null);
        setCanceledOnTouchOutside(false);
        View inflate = View.inflate(mContext, R.layout.dialog_withdraw, null);
        mBtnBack = inflate.findViewById(R.id.btn_back);
        mBtnPayAlipay = inflate.findViewById(R.id.btn_pay_alipay);
        mBtnPayWechat = inflate.findViewById(R.id.btn_pay_wechat);
        mIvPayAlipay = inflate.findViewById(R.id.iv_pay_alipay);
        mIvPayWechat = inflate.findViewById(R.id.iv_pay_wechat);
        return inflate;
    }

    @Override
    public void setUiBeforShow() {

        mBtnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        mBtnPayAlipay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mIvPayAlipay.setVisibility(View.VISIBLE);
                mIvPayAlipay.setImageResource(R.drawable.list_button_xuanze);
                mIvPayWechat.setVisibility(View.GONE);
                listenerInterface.doConfirm(0);
                dismiss();
            }
        });

        mBtnPayWechat.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                mIvPayAlipay.setVisibility(View.GONE);
                mIvPayWechat.setImageResource(R.drawable.list_button_xuanze);
                mIvPayWechat.setVisibility(View.VISIBLE);
                listenerInterface.doConfirm(1);
                dismiss();
            }
        });
    }

    public void setListener(MyClickListenerInterface listener) {
        this.listenerInterface = listener;
    }


    public interface MyClickListenerInterface {
        void doConfirm(int type);
    }
}

